#pragma once
#include"RBTree.h"


template<class Iterator, class Ref, class Ptr>
class __reverse_iterator
{
	typedef __reverse_iterator<Iterator, Ref, Ptr> self;

public:
	__reverse_iterator(const Iterator& it)
		:_it(it._cur, it._header)
	{}

	bool operator!=(const self& rit) const
	{
		return _it != rit._it;
	}

	Ref operator*() const
	{
		Iterator tmp = _it;
		--tmp;
		return *tmp;
	}

	Ptr operator->() const
	{
		Iterator  tmp = _it;
		--tmp;
		return &(tmp._cur->_date);
	}

	self operator++()
	{
		--_it;
		return *this;
	}

	self operator--()
	{
		++_it;
		return *this;
	}

private:
	Iterator _it;
};